home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / dejagnu.lha / dejagnu-1.0.1 / tcl / tests / unknown.test < prev    next >
Text File  |  1992-11-06  |  2KB  |  63 lines

  1. # Commands covered:  unknown
  2. #
  3. # This file contains a collection of tests for one or more of the Tcl
  4. # built-in commands.  Sourcing this file into Tcl runs the tests and
  5. # generates output for errors.  No output means no errors were found.
  6. #
  7. # Copyright 1991 Regents of the University of California
  8. # Permission to use, copy, modify, and distribute this
  9. # software and its documentation for any purpose and without
  10. # fee is hereby granted, provided that this copyright notice
  11. # appears in all copies.  The University of California makes no
  12. # representations about the suitability of this software for any
  13. # purpose.  It is provided "as is" without express or implied
  14. # warranty.
  15. #
  16. # $Header: /user6/ouster/tcl/tests/RCS/unknown.test,v 1.4 91/12/02 10:54:54 ouster Exp $ (Berkeley)
  17.  
  18. if {[string compare test [info procs test]] == 1} then {source defs}
  19.  
  20. catch {rename unknown {}}
  21.  
  22. test unknown-1.1 {non-existent "unknown" command} {
  23.     list [catch {_non-existent_ foo bar} msg] $msg
  24. } {1 {invalid command name: "_non-existent_"}}
  25.  
  26. proc unknown {args} {
  27.     global x
  28.     set x $args
  29. }
  30.  
  31. test unknown-2.1 {calling "unknown" command} {
  32.     foobar x y z
  33.     set x
  34. } {foobar x y z}
  35. test unknown-2.2 {calling "unknown" command with lots of args} {
  36.     foobar 1 2 3 4 5 6 7
  37.     set x
  38. } {foobar 1 2 3 4 5 6 7}
  39. test unknown-2.3 {calling "unknown" command with lots of args} {
  40.     foobar 1 2 3 4 5 6 7 8
  41.     set x
  42. } {foobar 1 2 3 4 5 6 7 8}
  43. test unknown-2.4 {calling "unknown" command with lots of args} {
  44.     foobar 1 2 3 4 5 6 7 8 9
  45.     set x
  46. } {foobar 1 2 3 4 5 6 7 8 9}
  47.  
  48. test unknown-3.1 {argument quoting in calls to "unkown"} {
  49.     foobar \{ \} a\{b \; "\\" \$a a\[b \]
  50.     set x
  51. } "foobar \\{ \\} a\\{b {;} \\\\ {\$a} {a\[b} \\]"
  52.  
  53. proc unknown args {
  54.     error "unknown failed"
  55. }
  56.  
  57. test unknown-4.1 {errors in "unknown" procedure} {
  58.     list [catch {non-existent a b} msg] $msg $errorCode
  59. } {1 {unknown failed} NONE}
  60.  
  61. catch {rename unknown {}}
  62. return {}
  63.